export default {
    data() {
        return {
            content: "", // 反馈内容
            phone: "", // 电话
        }
    },
    methods: {

        // 内容输入
        contentInput: function(options) {
            let value = options.detail.value;
            this.content = value;
        },

        // 电话输入
        phoneInput: function(options) {
            let value = options.detail.value;
            this.phone = value;
        },

        // 提交
        push: function() {
            console.log(this)
            if (!this.content || this.content == '') {
                uni.showToast({
                    title: '请填写反馈内容',
                    icon: 'none'
                });
                return false;
            }
            let data = {
                content: this.content, // 内容
                phone: this.phone, // 电话
                deviceId: this.$store.state.deviceId, // 设备id
                userId: this.$store.state.userInfo.userId, // 用户id
            }
            this.$request(this.$api.PushOpinion, data, "POST").then(res => {
                if (res.returnCode == "SUCCESS") {
                    uni.showModal({
                        title: '提示',
                        content: res.returnMessage == '' ? '提交成功' : res.returnMessage,
                        showCancel: false,
                        success: () => {
                            uni.navigateBack();
                        }
                    });
                } else {
                    uni.showModal({
                        title: '提示',
                        content: res.returnMsg,
                        showCancel: false,
                    });
                }
            })
        },
    }
}